package com.le;

import com.le.bean.Piece;

import java.util.ArrayList;
import java.util.List;

public class chess {

    public static void main(String[] args) {

        int[][] QiPan = new int[9][10];
        // 初始棋盘
        List<Piece> pieces = init();
        for (Piece p: pieces){
            QiPan[p.getX()][p.getY()] = p.getId();
        }

        for (int[] q1: QiPan){
            for (int q2: q1){
                System.out.printf("%-4d",q2);
            }
            System.out.println();
        }

    }

    // 初始化程序
    private static List<Piece> init(){
        List<Piece> result = new ArrayList<>();
        Piece piece;
        piece = new Piece(1, "車", "红", 1, 0, 0);
        result.add(piece);

        piece = new Piece(2, "车", "黑", 1, 0, 9);
        result.add(piece);

        piece = new Piece(3, "車", "红", 1, 8, 0);
        result.add(piece);

        piece = new Piece(4, "车", "黑", 1, 8, 9);
        result.add(piece);

        piece = new Piece(5, "馬", "红", 1, 1, 0);
        result.add(piece);

        piece = new Piece(6, "马", "黑", 1, 1, 9);
        result.add(piece);

        piece = new Piece(7, "馬", "红", 1, 7, 0);
        result.add(piece);

        piece = new Piece(8, "马", "黑", 1, 7, 9);
        result.add(piece);

        piece = new Piece(9, "相", "红", 1, 2, 0);
        result.add(piece);

        piece = new Piece(10, "象", "黑", 1, 2, 9);
        result.add(piece);

        piece = new Piece(11, "相", "红", 1, 6, 0);
        result.add(piece);

        piece = new Piece(12, "象", "黑", 1, 6, 9);
        result.add(piece);

        piece = new Piece(13, "仕", "红", 1, 3, 0);
        result.add(piece);

        piece = new Piece(14, "士", "黑", 1, 3, 9);
        result.add(piece);

        piece = new Piece(15, "仕", "红", 1, 5, 0);
        result.add(piece);

        piece = new Piece(16, "士", "黑", 1, 5, 9);
        result.add(piece);

        piece = new Piece(17, "帅", "红", 1, 4, 0);
        result.add(piece);

        piece = new Piece(18, "将", "黑", 1, 4, 9);
        result.add(piece);


        piece = new Piece(19, "砲", "红", 1, 1, 2);
        result.add(piece);

        piece = new Piece(20, "炮", "黑", 1, 1, 7);
        result.add(piece);

        piece = new Piece(21, "砲", "红", 1, 7, 2);
        result.add(piece);

        piece = new Piece(22, "炮", "黑", 1, 7, 7);
        result.add(piece);


        piece = new Piece(23, "兵", "红", 1, 0, 3);
        result.add(piece);

        piece = new Piece(24, "卒", "黑", 1, 0, 6);
        result.add(piece);

        piece = new Piece(25, "兵", "红", 1, 2, 3);
        result.add(piece);

        piece = new Piece(26, "卒", "黑", 1, 2, 6);
        result.add(piece);

        piece = new Piece(27, "兵", "红", 1, 4, 3);
        result.add(piece);

        piece = new Piece(28, "卒", "黑", 1, 4, 6);
        result.add(piece);

        piece = new Piece(29, "兵", "红", 1, 6, 3);
        result.add(piece);

        piece = new Piece(30, "卒", "黑", 1, 6, 6);
        result.add(piece);

        piece = new Piece(31, "兵", "红", 1, 8, 3);
        result.add(piece);

        piece = new Piece(32, "卒", "黑", 1, 8, 6);
        result.add(piece);

        return result;
    }
}
